<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class desa_model extends CI_model {
    
    function __construct() {
        parent::__construct();
        $this->load->database();
    }
    
    public function get_layer_kabupaten(){
        return $this->db->query("select * from kabupaten");
    }
    
    
    
    public function get_all_kec(){
        return $this->db->query("select * from kecamatan order by kec_kode");
    }

    public function get_desa_poly($id_kec){
        
       if($id_kec==0){
        $query = $this->db->query('select * from kelurahan_new order by kec_kode');
       }
       else{
        $query = $this->db->query("select * from kelurahan_new where KEC_KODE = $id_kec order by kec_kode");           
       }
       return $query;
    }
    
    public function get_kec_poly($id_kec){
       if($id_kec==0){
        $query = $this->db->query('select * from kecamatan order by kec_kode');
       }
       else{
        $query = $this->db->query("select * from kecamatan where KEC_KODE = $id_kec order by kec_kode");           
       }
       return $query;
    }
    
    
}